// import React from "react";
import "./children.css";
import imgSrc from "../assets/s3.png";

interface childType {
  list: Array<any>;
  myCount: number;
  title?: string;
  addFunc: () => void;
}
// childType: childType

function Children({ title, list, myCount,addFunc }: childType) {
  const childInfo = {
    title: "这是子组件",
    desc: "测试子组件接受props参数",
    imgSrc: imgSrc,
  };
  return (
    <>
      <div className="child">
        <h1>{title || childInfo.title}</h1>
        <p>{childInfo.desc}</p>
        <img src={childInfo.imgSrc} className="authro" />
        <div>{myCount}</div>
        <div onClick={()=>{addFunc()}} >列表添加</div>
        {list.map((item, index) => (
          <div key={index}>{item}</div>
        ))}
      </div>
    </>
  );
}

export default Children;
